<?php
	require_once(realpath(dirname(__FILE__)) . "/Baseobj.class.php");

	class Promo extends Baseobj{

		var $id;
		var $code;
		var $type;
		var $valeur;
		var $mini;
		var $utilise;
		var $illimite;
		var $datefin;

		const TABLE="promo";
		var $table=self::TABLE;

		var $bddvars = array("id", "code", "type", "valeur", "mini", "utilise", "illimite", "datefin");

		function __construct(){
			parent::__construct();
		}

		function charger($code){
			$datedj = date("Y-m-d H:i:s");
		 	return $this->getVars("select * from $this->table where code=\"$code\" and (datefin>'$datedj' or datefin='0000-00-00') and utilise='0'");

		}

		function charger_id($id){
			return $this->getVars("select * from $this->table where id=\"$id\"");
		}

	}

?>